package com.zmn.plat.admin.controller.product.picture;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import com.zmn.plat.manager.dictionary.ProductDict;
import com.zmn.plat.model.vo.mast.ImageReslutDTO;

@Controller
@RequestMapping("/tariffProduct/picture/")
public class TariffServProductPictureListController extends ServProductPictureBaseController {
    /**
     * 描述: 产品详情
     *
     * @param productId
     *            产品ID
     * @return ModelAndView 产品详情页面
     * @modifier tanbiao 2019/09/30 前台后台产品代码整理
     */
    @RequestMapping("detail")
    public ModelAndView showDetail(@RequestParam(value = "productId", defaultValue = "0") Integer productId) {
        ModelAndView mav = new ModelAndView("product/tariff/productpicture");
        super.detail(mav, productId);
        return mav;
    }

    /**
     * 描述: 文件上传
     *
     * @param file
     *            文件对象
     * @param timestamp
     *            时间戳
     * @param elemId
     *            元素id
     * @return com.zmn.common.dto.ImageUploadDTO
     * @author wangjie
     * @since 2018/10/22 10:56
     * @modifier tanbiao 20190930 前台后台产品代码整理
     */
    @RequestMapping(value = "uploaderImage")
    @ResponseBody
    public ImageReslutDTO uploaderMasterImage(@RequestParam(value = "file") MultipartFile file,
        @RequestParam(value = "timestamp") String timestamp, @RequestParam(value = "elemId") String elemId) {

        return super.uploaderImage(file, ProductDict.SERV_PRODUCT_UPLOAD_IMAGES_PATH, elemId, timestamp);
    }

}
